package com.sample.base.rxjava;

import android.content.Context;

import androidx.annotation.NonNull;

import com.loyal.client.RxConfig;
import com.loyal.rx3.BaseRxSubscriber;
import com.loyal.rx3.RetroManager;

import java.util.Map;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.RequestBody;

public class RxServerSubscriber<T> extends BaseRxSubscriber<T> implements ServiceServer {
    private ServiceServer server;

    @Override
    public void createServer(RetroManager retrofitManage) {
        server = retrofitManage.createServer(ServiceServer.class);
    }

    public RxServerSubscriber(Context context, @NonNull RxConfig config) {
        super(context, config);
    }

    @Override
    public Observable<String> login(String account, String password) {
        return server.login(account, password);
    }

    @Override
    public Observable<String> savePhoto(String userJson, Map<String, RequestBody> mapParams) {
        return server.savePhoto(userJson, mapParams);
    }
}
